Optimal. Leaf size=79 \[ -\frac{(4 A-B) \sin (c+d x)}{3 a^2 d (\cos (c+d x)+1)}+\frac{A \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-B) \sin (c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.179628, antiderivative size = 79, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.103, Rules used = {2978, 12, 3770} \[ -\frac{(4 A-B) \sin (c+d x)}{3 a^2 d (\cos (c+d x)+1)}+\frac{A \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-B) \sin (c+d x)}{3 d (a \cos (c+d x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2978
Rule 12
Rule 3770
Rubi steps
\begin{align*} \int \frac{(A+B \cos (c+d x)) \sec (c+d x)}{(a+a \cos (c+d x))^2} \, dx &=-\frac{(A-B) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac{\int \frac{(3 a A-a (A-B) \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=-\frac{(4 A-B) \sin (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac{(A-B) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac{\int 3 a^2 A \sec (c+d x) \, dx}{3 a^4}\\ &=-\frac{(4 A-B) \sin (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac{(A-B) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac{A \int \sec (c+d x) \, dx}{a^2}\\ &=\frac{A \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(4 A-B) \sin (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac{(A-B) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2}\\ \end{align*}
Mathematica [B] time = 0.487366, size = 170, normalized size = 2.15 \[ -\frac{2 \cos \left (\frac{1}{2} (c+d x)\right ) \left ((A-B) \tan \left (\frac{c}{2}\right ) \cos \left (\frac{1}{2} (c+d x)\right )+(A-B) \sec \left (\frac{c}{2}\right ) \sin \left (\frac{d x}{2}\right )+2 (4 A-B) \sec \left (\frac{c}{2}\right ) \sin \left (\frac{d x}{2}\right ) \cos ^2\left (\frac{1}{2} (c+d x)\right )+6 A \cos ^3\left (\frac{1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )\right )\right )}{3 a^2 d (\cos (c+d x)+1)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.082, size = 119, normalized size = 1.5 \begin{align*} -{\frac{A}{6\,{a}^{2}d} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) ^{3}}+{\frac{B}{6\,{a}^{2}d} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) ^{3}}-{\frac{3\,A}{2\,{a}^{2}d}\tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) }+{\frac{B}{2\,{a}^{2}d}\tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) }-{\frac{A}{{a}^{2}d}\ln \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) -1 \right ) }+{\frac{A}{{a}^{2}d}\ln \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) +1 \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.26967, size = 196, normalized size = 2.48 \begin{align*} -\frac{A{\left (\frac{\frac{9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac{\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac{6 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac{6 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )} - \frac{B{\left (\frac{3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac{\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a^{2}}}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.37993, size = 338, normalized size = 4.28 \begin{align*} \frac{3 \,{\left (A \cos \left (d x + c\right )^{2} + 2 \, A \cos \left (d x + c\right ) + A\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \,{\left (A \cos \left (d x + c\right )^{2} + 2 \, A \cos \left (d x + c\right ) + A\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \,{\left ({\left (4 \, A - B\right )} \cos \left (d x + c\right ) + 5 \, A - 2 \, B\right )} \sin \left (d x + c\right )}{6 \,{\left (a^{2} d \cos \left (d x + c\right )^{2} + 2 \, a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \frac{\int \frac{A \sec{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos{\left (c + d x \right )} + 1}\, dx + \int \frac{B \cos{\left (c + d x \right )} \sec{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos{\left (c + d x \right )} + 1}\, dx}{a^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.23498, size = 153, normalized size = 1.94 \begin{align*} \frac{\frac{6 \, A \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac{6 \, A \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} - \frac{A a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 9 \, A a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 3 \, B a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{a^{6}}}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]